package me.zhengjie.modules.quartz.service

import me.zhengjie.logging.annotation.Log
import me.zhengjie.modules.quartz.domain.QuartzJob
import me.zhengjie.modules.quartz.domain.QuartzLog
import jakarta.servlet.http.HttpServletResponse
import java.io.IOException
import me.zhengjie.modules.quartz.service.dto.JobQueryCriteria

import org.springframework.data.domain.Pageable
import me.zhengjie.common.utils.PageResult
/**
 * @author Kuki Wu
 * @date 2019-01-07
 */
interface QuartzJobService {
    /**
     * 分页查询
     * @param criteria 条件
     * @param pageable 分页参数
     * @return /
     */
     fun queryAll(
        criteria: JobQueryCriteria?,
        pageable: Pageable?
    ): PageResult<QuartzJob?>?

    /**
     * 查询全部
     * @param criteria 条件
     * @return /
     */
     fun queryAll(criteria: JobQueryCriteria?): MutableList<QuartzJob?>?

    /**
     * 分页查询日志
     * @param criteria 条件
     * @param pageable 分页参数
     * @return /
     */
     fun queryAllLog(
        criteria: JobQueryCriteria?,
        pageable: Pageable?
    ): PageResult<QuartzLog?>?

    /**
     * 查询全部
     * @param criteria 条件
     * @return /
     */
     fun queryAllLog(criteria: JobQueryCriteria?): MutableList<QuartzLog?>?

    /**
     * 创建
     * @param resources /
     */
     fun create(resources: QuartzJob?)

    /**
     * 编辑
     * @param resources /
     */
     fun update(resources: QuartzJob?)

    /**
     * 删除任务
     * @param ids /
     */
     fun delete(ids:Set<Long?>?)

    /**
     * 根据ID查询
     * @param id ID
     * @return /
     */
     fun findById(id: Long?): QuartzJob?

    /**
     * 更改定时任务状态
     * @param quartzJob /
     */
     fun updateIsPause(quartzJob: QuartzJob?)

    /**
     * 立即执行定时任务
     * @param quartzJob /
     */
     fun execution(quartzJob: QuartzJob?)

    /**
     * 导出定时任务
     * @param queryAll 待导出的数据
     * @param response /
     * @throws IOException /
     */
    @Throws(java.io.IOException::class)
     fun download(queryAll: MutableList<QuartzJob?>?, response: HttpServletResponse?)

    /**
     * 导出定时任务日志
     * @param queryAllLog 待导出的数据
     * @param response /
     * @throws IOException /
     */
    @Throws(java.io.IOException::class)
     fun downloadLog(queryAllLog: MutableList<QuartzLog?>?, response: HttpServletResponse?)

    /**
     * 执行子任务
     * @param tasks /
     * @throws InterruptedException /
     */
    @Throws(InterruptedException::class)
     fun executionSubJob(tasks: Array<String?>?)
}